package ar.edu.unq.wannaplay.panels.employee;

import java.util.List;

import ar.edu.unq.wannaplay.dtos.SkillDTO;
import ar.edu.unq.wannaplay.pages.employee.EditEmployeePage;
import ar.edu.unq.wannaplay.panels.AbstractEditModelObjectSkillsPanel;
import ar.edu.unq.wannaplay.services.EmployeeService;
import ar.edu.unq.wannaplay.utils.EmployeeEditer;

public class EditEmployeeSkillsPanel extends AbstractEditModelObjectSkillsPanel<EmployeeEditer, EmployeeService> {

    public EditEmployeeSkillsPanel(final String id, final EmployeeEditer aModelObject,
            final EmployeeService employeeService) {
        super(id, aModelObject, employeeService);
    }

    private static final long serialVersionUID = 1L;

    @Override
    protected List<SkillDTO> getModelObjectSkills() {
        return this.getModelObject().getSkillsDTO();
    }

    @Override
    protected void onAcceptAction() {
        this.getModelObject().setSkillsDTO(this.getSkillsList());
        this.getService().updateEmployee(this.getModelObject().getDni(), this.getSkillsList());
    }

    @Override
    protected void setResponsePageAbs() {
        this.setResponsePage(new EditEmployeePage(this.getModelObject(), this.getService()));
    }
}
